package sgd.tp2.server.metrics;

public class MessageMetric {
	private long sendTime = 0;
	private long receivedTime = 0;

	private long startHandlingTime = 0;
	private long endHandlingTime = 0;

	public MessageMetric() {
	}

	public long totalHandlingTime() {
		return getEndHandlingTime() - getStartHandlingTime();
	}

	public long totalSendingTime() {
		return getReceivedTime() - getSendTime();
	}

	public void setStartHandlingTime() {
		this.startHandlingTime = System.nanoTime();
	}

	public long getStartHandlingTime() {
		return startHandlingTime;
	}

	public void setEndHandlingTime() {
		this.endHandlingTime = System.nanoTime();
	}

	public long getEndHandlingTime() {
		return endHandlingTime;
	}

	public void setSendTime(long sendTime) {
		this.sendTime = sendTime;
	}

	public long getSendTime() {
		return sendTime;
	}

	public void setReceivedTime() {
		this.receivedTime = System.nanoTime();
	}

	public long getReceivedTime() {
		return receivedTime;
	}
}
